﻿using SelfMadeMillionaire.Core.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace SelfMadeMillionaire.Core.Entities
{
	public class Publication : BaseEntity
	{
		[StringLength(100)]
		public string Title { get; set; }
		[DisplayName("Product")]
		public byte ProductType { get; set; }
		[DisplayName("Short Text")]
		[StringLength(4000)]
		public string ShortText { get; set; }
		[DisplayName("External Link")]
		[StringLength(250, ErrorMessage = "Must be under 250 characters")]
		[RegularExpression(@"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$", ErrorMessage = "Not a valid external link")]
		public string ExternalUrl { get; set; }
		[StringLength(100)]
		public string PdfFileName { get; set; }
		public string HtmlContent { get; set; }
		[DisplayName("Home Page Publication")]
		public bool IsShowOnHomePage { get; set; }
        [DisplayName("Start Page Publication")]
        public bool IsShowOnStartPage { get; set; }
		[DisplayName("Education")]
		public bool IsEducation { get; set; }
		public DateTime CreatedDate { get; set; }
		public DateTime Date { get; set; }

		public byte MinAccessLevel { get; set; }
        public byte MinAccessLevelOriginal { get; set; }

		public virtual EmailMessage EmailMessage { get; set; }
        public virtual ICollection<PublicationProduct> Products { get; set; }
	}
}
